import request from '@/libs/request'

/**
 * 课程列表
 * @returns
 */
export const courseList = data => {
  return request({
    url: `/course/list`,
    method: 'post',
    data
  })
}

/**
 * 用户标识课程列表
 * @returns
 */
 export const courseUserList = data => {
  return request({
    url: `/course/user/list`,
    method: 'post',
    data
  })
}

/**
 * 课程详情
 * @returns
 */
export const courseInfo = data => {
  return request({
    url: `/course/${data.course_id}/info`,
    method: 'get'
  })
}

/**
 * 添加课程
 * @returns
 */
export const courseAdd = data => {
  return request({
    url: `/course/add`,
    method: 'post',
    data: data
  })
}

/**
 * 修改课程
 * @returns
 */
export const courseEdit = data => {
  return request({
    url: `/course/${data.course_id}/info`,
    method: 'put',
    data
  })
}

/**
 * 删除课程
 * @returns
 */
export const courseDelete = data => {
  return request({
    url: `/course/${data.course_id}/info`,
    method: 'delete'
  })
}
